package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpInventoryRequisitionEntryPageUtil extends SeleniumPageUtil {
	
	public final static By IRE_A_NEW_REQUISITION = By.id("ctl44_btnNew");
	public final static By IRE_A_SHOW_MY_ORDERS = By.id("ctl44_btnShowAll");
	
	public final static By IRE_SPAN_HEADER = By.id("ctl44_lblTitle");
	
	public final static By IRE_DIV_REQUISITION_DETAILS = By.xpath("//*[@id='ctl44_pnlForm']/div[1]");
	public final static By IRE_DIV_WAREHOUSE_AVAILABILITY = By.xpath("//*[@id='ctl44_pnlAvailability']/div[1]");
	public final static By IRE_SPAN_PART_NUMBER_ITEM = By.id("ctl44_lblItem");
	public final static By IRE_SPAN_PART_NUMBER_ITEM_REQD = By.xpath("//*[@id='ctl44_pnlForm']/div[2]/table/tbody/tr[1]/td[1]/span[2]");
	public final static By IRE_INPUT_PART_NUMBER_ITEM = By.id("ctl44_txtItemNumber");
	public final static By IRE_PART_NUMBER_ITEM_LIST = By.id("ctl44_aceItem_completionListElem");
	public final static By IRE_SPAN_WAREHOUSE = By.id("ctl44_lblWareHouse");
	public final static By IRE_SPAN_WAREHOUSE_REQD = By.xpath("//*[@id='ctl44_pnlForm']/div[2]/table/tbody/tr[2]/td[1]/span[2]");
	public final static By IRE_INPUT_WAREHOUSE = By.id("ctl44_txtWarehouse");
	public final static By IRE_UI_WAREHOUSE_ITEM = By.id("aceWhseID_Behavior_completionListElem");
	public final static By IRE_SPAN_QUANTITY_REQUESTED = By.id("ctl44_lblQuantity");
	public final static By IRE_SPAN_QUANTITY_REQUESTED_REQD = By.xpath("//*[@id='ctl44_pnlForm']/div[2]/table/tbody/tr[3]/td[1]/span[2]");
	public final static By IRE_INPUT_QUANTITY_REQUESTED = By.id("ctl44_txtQuantity");
	public final static By IRE_SPAN_UNIT_AVG_COST_GUIDE = By.id("ctl44_lblUnitPrice");
	public final static By IRE_INPUT_UNIT_AVG_COST_GUIDE = By.id("ctl44_txtItemCost");
	public final static By IRE_SPAN_ESTIMATED_COST = By.id("ctl44_lblTotalCost");
	public final static By IRE_INPUT_ESTIMATED_COST = By.id("ctl44_txtTotalCost");
	public final static By IRE_SPAN_DESIRED_DATE = By.id("ctl44_lblDate");
	public final static By IRE_INPUT_DESIRED_DATE = By.id("ctl44_dteDate_txtDatePart");
	public final static By IRE_IMG_DESIRED_DATE = By.id("ctl44_dteDate_imgDateCalendar");
	public final static By IRE_DIV_CLOSE_DATE = By.id("ctl44_dteDate_txtDatePart_CalendarExtender_close");
	public final static By IRE_SPAN_DESCRIPTION = By.id("ctl44_lblDescription");
	public final static By IRE_TEXTAREA_DESCRIPTION = By.id("ctl44_txtDescription");
	public final static By IRE_SPAN_JUSTIFICATION = By.id("ctl44_lblJustification");
	public final static By IRE_TEXTAREA_JUSTIFICATION = By.id("ctl44_txtJustification");
	public final static By IRE_SPAN_COMMENTS = By.id("ctl44_lblComments");
	public final static By IRE_TEXTAREA_Comments = By.id("ctl44_txtComments");
	public final static By IRE_SPAN_REASON = By.id("ctl44_lblReasonCode");
	public final static By IRE_SPAN_REASON_REQD = By.xpath("//*[@id='ctl44_pnlForm']/div[2]/table/tbody/tr[10]/td[1]/span[2]");
	public final static By IRE_SELECT_REASON = By.id("ctl44_ddlReasonCodes");
	public final static By IRE_SPAN_SRO_NUMBER = By.id("ctl44_lblSroNumber");
	public final static By IRE_SPAN_SRO_NUMBER_REQD = By.id("conditionalReqSro");
	public final static By IRE_INPUT_SRO_NUMBER = By.id("ctl44_txtSroNumber");
	public final static By IRE_SRO_NUMBER_LIST = By.id("aceSro_completionListElem");
	public final static By IRE_SPAN_CUSTOMER_NAME = By.id("ctl44_lblCustomer");
	public final static By IRE_SPAN_CUSTOMER_NAME_REQD = By.xpath("//*[@id='ctl44_pnlForm']/div[2]/table/tbody/tr[12]/td[1]/span[2]");
	public final static By IRE_INPUT_CUSTOMER_NAME = By.id("ctl44_txtCustomer");
	public final static By IRE_SPAN_CONTRACT_NUMBER = By.id("ctl44_lblContract");
	public final static By IRE_SPAN_CONTRACT_NUMBER_REQD = By.id("conditionalReqContract");
	public final static By IRE_INPUT_CONTRACT_NUMBER = By.id("ctl44_txtContractID");
	public final static By IRE_SPAN_DROP_SHIP = By.id("ctl44_lblDropShip");
	public final static By IRE_INPUT_CHECKBOX_DROP_SHIP = By.id("chkDropShip");
	public final static By IRE_A_SUBMIT = By.id("ctl44_lnkSubmit");
	public final static By IRE_A_CANCEL = By.id("ctl44_lnkCancel");
	
	// input value to part number/Item, a value of result list display.
	public final static By IRE_TD_PART_NUMBER = By.xpath("//*[@id='ctl44_aceItem_completionListElem']/table/tbody/tr/td[1]");
	
	// input value to SRO Number, a value of result list display.
	public final static By IRE_TD_SRO_NUMBER = By.xpath("//*[@id='aceSro_completionListElem']/table/tbody/tr/td[1]");
	public final static By IRE_LI_WAREHOUSE = By.xpath("//*[@id='aceWhseID_Behavior_completionListElem']/li[1]");
	
	
	public static void enterInventoryReqEntryPage() {
		SpHomePageUtil.enter();
		SpHomePageUtil.enterInventoryReqEntryPage();
	}
	
	public static void waitForInventoryReqEntryPageToLoad() {
		SeleniumUtil.waitForFixedMilliseconds(1000);
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				IRE_A_NEW_REQUISITION, IRE_A_SHOW_MY_ORDERS, IRE_IMG_DESIRED_DATE, IRE_A_SUBMIT, IRE_A_CANCEL
			});
		
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IRE_A_NEW_REQUISITION));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IRE_A_SHOW_MY_ORDERS));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IRE_IMG_DESIRED_DATE));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IRE_A_SUBMIT));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IRE_A_CANCEL));
	}
}
